<template>
  <view class="page">
    <!-- 顶部品牌区 -->
    <view class="header">
      <view class="header-title">中国移动微法院</view>
      <view class="header-content">
        <view class="brand-name">浙江移动微法院</view>
        <image class="logo-image" :src="logoUrl" mode="aspectFit" />
      </view>
    </view>

    <!-- 用户信息区 -->
    <view class="user-info">
      <view class="welcome">
        <text>欢迎您，诸葛亮</text>
        <view class="certified">
          <uni-icons type="person-filled" size="14" color="#0066ff" />
          <text>已认证</text>
        </view>
      </view>

      <!-- 功能区网格 -->
      <view class="grid-container">
        <view class="grid-item" @click="open">
          <uni-icons type="email" size="28" color="#0066ff" />
          <text>我要立案</text>
        </view>
        <view class="grid-item">
          <uni-icons type="folder" size="28" color="#0066ff" />
          <text>我的案件</text>
        </view>
        <view class="grid-item">
          <uni-icons type="wallet" size="28" color="#0066ff" />
          <text>诉讼交费</text>
        </view>
        <view class="grid-item">
          <uni-icons type="staff" size="28" color="#0066ff" />
          <text>诉前调解</text>
        </view>
        <view class="grid-item">
          <uni-icons type="phone" size="28" color="#0066ff" />
          <text>手机阅卷</text>
        </view>
        <view class="grid-item">
          <uni-icons type="calculator" size="28" color="#0066ff" />
          <text>计算工具</text>
        </view>
        <view class="grid-item">
          <uni-icons type="help" size="28" color="#0066ff" />
          <text>智能问答</text>
        </view>
        <view class="grid-item">
          <uni-icons type="search" size="28" color="#0066ff" />
          <text>法规查询</text>
        </view>
        <view class="grid-item">
          <uni-icons type="map" size="28" color="#0066ff" />
          <text>法院导航</text>
        </view>
      </view>
      <!-- 使用 uni-popup 组件，ref 属性用于获取组件实例，type 属性用于设置弹出框类型，border-radius 属性用于设置弹出框的圆角 -->
      <uni-popup ref="popup" type="top" border-radius="10px 10px 0 0">
        <view class="popup-content">
          <view v-for="(item, index) in items" :key="index" class="list-item" @click="handleItemClick(item)">
            {{ item }}
          </view>
        </view>
      </uni-popup>
    </view>
  </view>
</template>

<script setup>
export default {
  data() {
    return {
      //logoUrl: 'https://ai-public.mastergo.com/ai/img_res/80d5e40b4d034ef73834842adcd853eb.jpg',
      items: ['风险评估（可选）', '审判立案', '执行立案', '批量立案', '取消']
    };
  },
  methods: {
    open() {
      // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
      this.$refs.popup.open('bottom');
    },
    handleItemClick(item) {
      // 点击选项后的处理逻辑
      console.log('点击了选项:', item);
      // 关闭弹出框
      this.$refs.popup.close();
    }
  }
};
//import ref from 'vue';
//const logoUrl = ref('https://ai-public.mastergo.com/ai/img_res/80d5e40b4d034ef73834842adcd853eb.jpg');
</script>

<style>
page {
  height: 100%;
}

.page {
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #f5f5f5;
}

.header {
  background-color: #0066ff;
  padding: 20rpx 30rpx 120rpx;
}

.header-title {
  color: #ffffff;
  font-size: 14px;
  margin-bottom: 40rpx;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  color: #ffffff;
  font-size: 20px;
  font-weight: bold;
}

.logo-image {
  width: 80rpx;
  height: 80rpx;
  margin-left: 20rpx;
}

.user-info {
  margin-top: -60rpx;
  margin-horizontal: 30rpx;
  padding: 40rpx;
  background-color: #ffffff;
  border-radius: 20px 20px 0 0;
  flex: 1;
}

.welcome {
  display: flex;
  align-items: center;
  margin-bottom: 40rpx;
}

.welcome text {
  font-size: 16px;
  color: #333333;
}

.certified {
  display: flex;
  align-items: center;
  background-color: #e6f0ff;
  padding: 4rpx 16rpx;
  border-radius: 30rpx;
  margin-left: 20rpx;
}

.certified text {
  font-size: 12px;
  color: #0066ff;
  margin-left: 4rpx;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40rpx;
  padding: 20rpx 0;
}

.grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.grid-item text {
  margin-top: 16rpx;
  font-size: 14px;
  color: #333333;
}

.highlight {
  border: 1px solid #ff3333;
  border-radius: 8px;
  padding: 20rpx 0;
}

.tab-bar {
  display: flex;
  justify-content: space-around;
  padding: 20rpx 0;
  background-color: #ffffff;
  border-top: 1px solid #eeeeee;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tab-item text {
  margin-top: 8rpx;
  font-size: 12px;
  color: #999999;
}

.tab-item.active text {
  color: #0066ff;
}

.popup-content {
  background-color: #ffffff;
  padding: 20rpx;
  border-radius: 10px 10px 0 0;
}

.list-item {
  padding: 20rpx;
  border-bottom: 1px solid #eeeeee;
  text-align: center;
  font-size: 14px;
  color: #333333;
}

.list-item:last-child {
  border-bottom: none;
}
</style>
